using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework.Domain.Generators
{
    [TestClass]
    public class WhenUsingSecondsGenerator
    {
        [TestMethod]
        public void GenerateNextValueShouldReturn20090101001For20090101000()
        {
            DateTime input = new DateTime(2009, 1, 1, 0, 0, 0);

            IDiscreteValuesGenerator<DateTime> secondsGenerator = new SecondsGenerator();
            DateTime actual = secondsGenerator.GenerateNextValue(input);

            DateTime expected = new DateTime(2009, 1, 1, 0, 0, 1);

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void MaxValueShouldReturn99991231235959()
        {
            IDiscreteValuesGenerator<DateTime> secondsGenerator = new SecondsGenerator();
            DateTime actual = secondsGenerator.MaxValue;

            DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59);

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void GeneratePreviousValueShouldReturn20090101000001For20090101000002()
        {
            DateTime givenDay = new DateTime(2009, 1, 1, 0, 0, 2);
            IDiscreteValuesGenerator<DateTime> secondsGenerator = new SecondsGenerator();
            DateTime actual = secondsGenerator.GeneratePreviousValue(givenDay);
            DateTime expected = new DateTime(2009, 1, 1, 0, 0, 1);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void MinValueShouldReturn0()
        {
            IDiscreteValuesGenerator<DateTime> secondsGenerator = new SecondsGenerator();
            DateTime actual = secondsGenerator.MinValue;
            DateTime expected = new DateTime(0);
            Assert.AreEqual(expected, actual);
        }
    }
}